package bishi.baidu.two;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * @author: 唐小尊
 * @email: 1171702529@qq.com
 * @cate: 2021/09/07 20:24
 */
public class three {
    public static void main(String[] args) {
        int p = 1000000007;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();

        long[] nums = new long[n];
        sc.nextLine();
        String str = sc.nextLine();
        for (int i = k-1; i < n; i++) {
            Set<Integer> set = new HashSet<>();
            set.add(str.charAt(i) - 'a');
            for (int j = 0; j < i; j++) {
                set.add(str.charAt(j) - 'a');
                if (set.size() >= k) {
                    nums[i] = (nums[i] + (nums[j] == 0 ? 1 : nums[j])) % p;
                    if (str.charAt(j)==str.charAt(i)){
                        nums[i] -= nums[j];
                    }
                }
            }
        }
        System.out.println(Arrays.toString(nums));
        System.out.println(nums[n - 1]);
    }
}
